﻿import request from '/@/utils/request';
enum Api {
  AddTeacher = '/api/teacher/add',
  DeleteTeacher = '/api/teacher/delete',
  UpdateTeacher = '/api/teacher/update',
  PageTeacher = '/api/teacher/page',
  DetailTeacher = '/api/teacher/detail',
  ImportPreviewTeacher = '/api/teacher/importPreview',
  ImportTeacher = '/api/teacher/import',
  InitTeacherUser = '/api/teacher/initTeacherUser',
}

// 增加教师
export const addTeacher = (params?: any) =>
	request({
		url: Api.AddTeacher,
		method: 'post',
		data: params,
	});

// 删除教师
export const deleteTeacher = (params?: any) => 
	request({
			url: Api.DeleteTeacher,
			method: 'post',
			data: params,
		});

// 编辑教师
export const updateTeacher = (params?: any) => 
	request({
			url: Api.UpdateTeacher,
			method: 'post',
			data: params,
		});

// 分页查询教师
export const pageTeacher = (params?: any) => 
	request({
			url: Api.PageTeacher,
			method: 'post',
			data: params,
		});

// 详情教师
export const detailTeacher = (id: any) => 
	request({
			url: Api.DetailTeacher,
			method: 'get',
			data: { id },
		});

// 导入教师预览
export const importPreviewTeacher = (fileId: any) => 
	request({
			url: Api.ImportPreviewTeacher,
			method: 'get',
			data: { fileId },
		});

		// 导入教师
export const importTeacher = (params?: any) => 
	//console.log(params);
	request({
			url: Api.ImportTeacher,
			method: 'post',
			data: params,
		});

export const initTeacherUser = (params?: any) =>
		request({
			url: Api.InitTeacherUser,
			method: 'post',
			data: params,
		});